package com.example.demo;

import org.example.annotation.EnableKafkaMessage;
import org.example.config.LocalKafkaTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@EnableKafkaMessage
@SpringBootApplication(scanBasePackages = {"com.example.**"})
@Configuration
public class DemoApplication {

    @Value("${kafka.bootstrap.servers}")
    String kafkaBootstrapServers;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Bean
    public LocalKafkaTemplate initLocalKafkaProducerTemplate(){
        LocalKafkaTemplate template = new LocalKafkaTemplate();
//        template.setKafkaBootstrapServers(kafkaBootstrapServers);
        return template;
    }

}
